package com.bingxue.edu.management.education.controller;


import com.bingxue.edu.framework.common.model.Response;
import com.bingxue.edu.framework.security.ApiResource;
import com.bingxue.edu.management.education.model.query.ClassScheduleQuery;
import com.bingxue.edu.management.education.model.req.ClassroomScheduleReq;
import com.bingxue.edu.management.education.model.resp.ClassroomScheduleResp;
import com.bingxue.edu.management.education.model.resp.schedule.ClassScheduleResp;
import com.bingxue.edu.management.education.service.ClassScheduleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 课程表
 *
 * @author zq
 * @since 2024/09/14
 */
@Tag(name = "课程课表/教室课表")
@RestController
@RequestMapping("/education/class/schedule")
@RequiredArgsConstructor
public class ClassScheduleController {

    private final ClassScheduleService classScheduleService;

    @Operation(summary = "课程课表查询")
    @ApiResource("edu:schedule:read")
    @GetMapping("/class")
    public Response<List<ClassScheduleResp>> getClassSchedule(ClassScheduleQuery classScheduleQuery) {
        return Response.success(classScheduleService.getClassScheduleTable(classScheduleQuery));
    }

    @Operation(summary = "教室课表查询")
    @ApiResource("edu:schedule:read")
    @GetMapping("/classroom")
    public Response<ClassroomScheduleResp> getClassroomSchedule(ClassroomScheduleReq classroomScheduleReq) {
        return Response.success(classScheduleService.getClassroomScheduleTable(classroomScheduleReq));
    }
}
